﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using D2D = Microsoft.WindowsAPICodePack.DirectX.Direct2D1;
using DI = Microsoft.WindowsAPICodePack.DirectX.WindowsImagingComponent;
using DW = Microsoft.WindowsAPICodePack.DirectX.DirectWrite;

namespace Framework
{
    public class UIElement : Base
    {
        static UIElement()
        {
            RegisterType(typeof(UIElement));

            RegisterProp(typeof(UIElement), "ActualHeight", typeof(double), null);
            RegisterProp(typeof(UIElement), "ActualWidth", typeof(double), null);
            RegisterProp(typeof(UIElement), "AllowDrop", typeof(bool), null);
            RegisterProp(typeof(UIElement), "Opacity", typeof(double), null);
            RegisterProp(typeof(UIElement), "Clip", typeof(Geometry), null);
            RegisterProp(typeof(UIElement), "Effect", typeof(Effect), null);
            RegisterProp(typeof(UIElement), "OpacityMask", typeof(Brush), null);
            RegisterProp(typeof(UIElement), "IsHitTestVisible", typeof(bool), null);
            RegisterProp(typeof(UIElement), "Visibility", typeof(Visibility), null);
            RegisterProp(typeof(UIElement), "UseLayoutRounding", typeof(bool), null);
            RegisterProp(typeof(UIElement), "Cache", typeof(bool), null);
            RegisterProp(typeof(UIElement), "Language", typeof(Language), null);
            RegisterProp(typeof(UIElement), "Width", typeof(double), null);
            RegisterProp(typeof(UIElement), "Height", typeof(double), null);
            RegisterProp(typeof(UIElement), "HorizontalAlignment", typeof(HorizontalAlignment), null);
            RegisterProp(typeof(UIElement), "VerticalAlignment", typeof(VerticalAlignment), null);
            RegisterProp(typeof(UIElement), "Margin", typeof(Thickness), null);
            RegisterProp(typeof(UIElement), "Style", typeof(Style), null);
            RegisterProp(typeof(UIElement), "FlowDirection", typeof(FlowDirection), null);
            RegisterProp(typeof(UIElement), "Name", typeof(string), null);
            RegisterProp(typeof(UIElement), "Cursor", typeof(Cursor), null);
            RegisterProp(typeof(UIElement), "DataContext", typeof(object), null);
            RegisterProp(typeof(UIElement), "RenderTransform", typeof(Transform), null);
            RegisterProp(typeof(UIElement), "RenderTransformOrigin", typeof(Point), null);
        }

        public virtual void OnRender(DrawingContext drawingContext)
        {
        }

        public virtual void Draw(Window window, D2D.HwndRenderTarget target)
        {

        }
    }

    public sealed class Language
    {
        public string LanguageTag { get; private set; }

        private Language() { }

        public static Language GetLanguage(string tag)
        {
            return new Language() { LanguageTag = tag };
        }
    }

    public enum HorizontalAlignment
    {
        Left,
        Center,
        Right,
        Stretch,
    }

    public enum VerticalAlignment
    {
        Top,
        Center,
        Bottom,
        Stretch,
    }

    public enum Visibility
    {
        Visible,
        Collapsed
    }

}
